package utils;

import java.util.UUID;

public class MyUUID {

    public String getUUID() {
        UUID uuid = UUID.randomUUID();
        String str = uuid.toString();
        System.out.println(str);
        return str;
    }

    public String getUUID1() {
        UUID uuid = UUID.randomUUID();
        String str = uuid.toString().replace("-","");
        System.out.println(str);
        return str;
    }

    public String getUUIDByte(byte[] name) {
        UUID uuid = UUID.nameUUIDFromBytes(name);
        String str = uuid.toString().replace("-","");
        System.out.println(str);
        return str;
    }



    public static void main(String[] args) {
        MyUUID myUUID = new MyUUID();

        for(int i=0; i<10; i++) {
           myUUID.getUUID1();
        }

//        生成的一样
//        byte[] a = {1,2};
//        for(int i=0; i<10; i++) {
//            myUUID.getUUIDByte(a);
//        }
    }


}
